//
//  OpotionViewController.m
//  zhongjianProject
//
//  Created by Farben on 2020/4/15.
//  Copyright © 2020 Farben. All rights reserved.
//

#import "OptionalViewController.h"
#import "Header.h"
#import "PersonalContentView.h"
#import "OptionaldetailViewController.h"

@interface OptionalViewController ()
@property (nonatomic , strong)UIImageView* backImageView;


@end

@implementation OptionalViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
//    [self.view addSubview:self.backImageView];
    
    [self addSearchBar];
    //__weak typeof(self) weakSelf = self  weak typeof(self) weakSelf = self;
    
    __weak typeof(self) weakSelf = self;
    [self addCenterButtonwithSize:CGSizeMake(200, 50) andCenter:CGPointMake(ScreenWidth/2.f, ScreenHeight/2.f) WithComplete:^{
        [weakSelf.navigationController pushViewController:[[OptionaldetailViewController alloc]init] animated:YES];
    }];
}


- (UIImage *)buttonImageFromColor:(UIColor *)color{

    CGRect rect = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height);
    UIGraphicsBeginImageContext(rect.size);
    CGContextRef context = UIGraphicsGetCurrentContext();
    CGContextSetFillColorWithColor(context, [color CGColor]);
    CGContextFillRect(context, rect);
    UIImage *img = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    return img;
}

-(UIImageView*)backImageView{
    if(!_backImageView){
        _backImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"自选切图.jpeg"]];
        CGRect frame = (CGRect) {CGPointZero,self.view.frame.size};
        _backImageView.frame = frame;
        _backImageView.contentMode = UIViewContentModeScaleAspectFill;
    }
    return _backImageView;;
}


/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
